main(){int n,t,p;while(scanf("%d",&n)&&n){t=0;while(n--){scanf("%d",&p);t=t>p?t:p;}printf("%d\n",t);}}
